import axios from 'axios';
import {getAxios, postAxios} from "@/utils";

// 登录
export async function login(params: API.LoginParams): Promise<API.LoginResult>{
    const axiosParams = {
        url: '/login/login',
        data: params,
    }
    return postAxios(axiosParams);
}

//音频详情
export async function audioDetail(params: API.AudioDetailParams): Promise<API.AudioDetailResult>{
    const axiosParams = {
        url: '/audio/audioDetail',
        params: params,
    }
    return getAxios(axiosParams);
}

//领取红包
export async function receiveRedPacket(params: API.RedPacketParams): Promise<API.RedPacketResult>{
    const axiosParams = {
        url: '/audio/receiveRedPacket',
        data: params,
    }
    return postAxios(axiosParams);
}

//提交答案
export async function submitAnswer(params: API.SubmitQuizParams): Promise<API.SubmitAnswerResult>{
    const axiosParams = {
        url: '/audio/submitAnswer',
        data: params,
    }
    return postAxios(axiosParams);
}

//查询答题列表
export async function queryAnswerList(): Promise<API.QueryAnswerListResult>{
    const axiosParams = {
        url: '/self/searchAnswer',
    }
    return getAxios(axiosParams);
}

//查询个人详情
export async function queryUserInfo(): Promise<API.QueryUserInfoResult>{
    const axiosParams = {
        url: '/self/searchSelfDetail',
    }
    return getAxios(axiosParams);
}

//提交意见反馈
export async function submitFeedback(params: API.FeedbackParams): Promise<API.FeedbackResult>{
    const axiosParams = {
        url: '/self/submitFeedback',
        data: params,
    }
    return postAxios(axiosParams);
}

export async function wxSign(url: string): Promise<API.ApiResult>{
    const axiosParams = {
        url: '/wx/sign',
        params: {url: url},
    }
    return getAxios(axiosParams);
}

export async function getSaleMan(params: API.GetSaleManParams): Promise<API.GetSaleManResult>{
    const axiosParams = {
        url: '/self/searchSalesMan',
        params: params,
    }
    return getAxios(axiosParams);
}
